#include "imagedetaildialog.h"
#include "ui_imagedetaildialog.h"
#include "../mainwindow.h"

ImageDetailDialog::ImageDetailDialog(QWidget *parent)
    : QDialog(parent)
    , ui(new Ui::ImageDetailDialog)
{
    ui->setupUi(this);

    // 这个非常重要，目的是为了让该View能显示所有标号的图片
}

ImageDetailDialog::~ImageDetailDialog()
{
    delete ui;
}

void ImageDetailDialog::on_pushButtonDetailExit_clicked()
{
    this->close();
}

void ImageDetailDialog::SetImage(QString filename)
{
    //ui->widgetImage->SetImage(filename);
}

void ImageDetailDialog::SetImage(QImage image)
{
    ui->widgetImage->SetImage(image);
}

void ImageDetailDialog::SetImageNum(int imageNum){
    char* pDestBuffer = MainWindow::instance()->GetImageDestBuffer(imageNum);
    QImage image(IMAGE_WIDTH,IMAGE_HEIGHT,QImage::Format_BGR888);
    memcpy(image.bits(),pDestBuffer,IMAGE_WIDTH * IMAGE_HEIGHT * 3);

    SetImage(image);
}

void ImageDetailDialog::SetDetectionResult()
{

}
